package com.lh.gateway.config;

import com.lh.auth.utils.RsaUtils;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.File;
import java.security.PublicKey;

/**
 * @author liuhe
 * @date 2020/07/07
 */
@Data
@Component
@ConfigurationProperties(prefix = "leyi.jwt")
public class JwtProperties {

    private String publicKeyPath;
    private PublicKey publicKey; // 公钥
    private String cookieName;


    @PostConstruct
    public void init() {
        try {
            this.publicKey = RsaUtils.getPublicKey(publicKeyPath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
